{% extends "txlapp/base.html" %}  <!-- 修改为正确的base模板路径 -->

{% block content %}
<h1>通讯录名单</h1>
<table class="table">
    <thead>
        <tr>
            <th>部门</th>
            <th>姓名</th>
            <th>职位</th>
            <th>电话</th>
            <th>短号</th>
        </tr>
    </thead>
    <tbody>
        {% for contact in contacts %}
        <tr>
            <td>{{ contact.department.name }}</td>
            <td>{{ contact.name }}</td>
            <td>{{ contact.position }}</td>
            <td>{{ contact.phone }}</td>
            <td>{{ contact.short_code }}</td>
        </tr>
        {% endfor %}
    </tbody>
</table>

<div class="pagination">
    <span class="step-links">
        {% if contacts.has_previous %}
            <a href="?page=1">&laquo; 首页</a>
            <a href="?page={{ contacts.previous_page_number }}">上一页</a>
        {% endif %}

        <span class="current">
            第 {{ contacts.number }} 页 / 共 {{ contacts.paginator.num_pages }} 页
        </span>

        {% if contacts.has_next %}
            <a href="?page={{ contacts.next_page_number }}">下一页</a>
            <a href="?page={{ contacts.paginator.num_pages }}">末页 &raquo;</a>
        {% endif %}
    </span>
</div>
{% endblock %}